/**
 * Copyright &copy; 2015-2020 <a href="http://www.easyhis.com/">easyhis</a> All rights reserved.
 */
package com.easy.dfcshop.entity;

import com.easy.common.utils.excel.annotation.ExcelField;
import com.easy.core.persistence.DataEntity;
import com.easy.modules.sys.entity.User;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 商品评价Entity
 * @author waylen chi
 * @version 2018-01-17
 */
public class Comment extends DataEntity<Comment> {
	
	private static final long serialVersionUID = 1L;
	private String id;		// UUID
	private Integer commentId;		// 用户评论的自增id
	private String commentType;		// 用户评论的类型;0评论的是商品,1评论的是文章
	private Integer objectId;		// 文章或者商品的id,文章对应的是article的article_id;商品对应的是product的product_id
	private User user;		// 发表该评论的用户的用户id,取值user的user_id
	private String banonymous;		// 是否匿名显示 0--显示发帖人昵称，1-匿名显示
	private Integer orderId;		// 订单ID，对应购买的订单ID
	private String content;		// 评论的内容
	private String totalRank;		// 综合评论只有1到5星;由数字代替;其中5代表5星
	private Integer descRank;		// 描述评论 只有1到5星;由数字代替;其中5代表5星
	private Integer servRank;		// 服务评论
	private Integer deliverRank;		// 货运评论
	private String ipAddress;		// 评论时的用户IP
	private String isShow;		// 是否被管理员批准显示;1是;0未批准显示
	private Comment parent;		// 评论的父节点,取值该表的comment_id字段,如果该字段为0,则是一个普通评论,否则该条评论就是该字段的值所对应的评论的回复
	private Date createTime;		// 创建时间
	
	public Comment() {
		super();
	}

	public Comment(String id){
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@NotNull(message="用户评论的自增id不能为空")
	@ExcelField(title="用户评论的自增id", align=2, sort=0)
	public Integer getCommentId() {
		return commentId;
	}

	public void setCommentId(Integer commentId) {
		this.commentId = commentId;
	}
	
	@ExcelField(title="用户评论的类型;0评论的是商品,1评论的是文章", align=2, sort=1)
	public String getCommentType() {
		return commentType;
	}

	public void setCommentType(String commentType) {
		this.commentType = commentType;
	}
	
	@ExcelField(title="文章或者商品的id,文章对应的是article的article_id;商品对应的是product的product_id", align=2, sort=2)
	public Integer getObjectId() {
		return objectId;
	}

	public void setObjectId(Integer objectId) {
		this.objectId = objectId;
	}
	
	@ExcelField(title="发表该评论的用户的用户id,取值user的user_id", fieldType=User.class, value=".userName", align=2, sort=3)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@ExcelField(title="是否匿名显示 0--显示发帖人昵称，1-匿名显示", align=2, sort=4)
	public String getBanonymous() {
		return banonymous;
	}

	public void setBanonymous(String banonymous) {
		this.banonymous = banonymous;
	}
	
	@ExcelField(title="订单ID，对应购买的订单ID", align=2, sort=5)
	public Integer getOrderId() {
		return orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}
	
	@ExcelField(title="评论的内容", align=2, sort=6)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	@ExcelField(title="综合评论只有1到5星;由数字代替;其中5代表5星", align=2, sort=7)
	public String getTotalRank() {
		return totalRank;
	}

	public void setTotalRank(String totalRank) {
		this.totalRank = totalRank;
	}
	
	@ExcelField(title="描述评论 只有1到5星;由数字代替;其中5代表5星", align=2, sort=8)
	public Integer getDescRank() {
		return descRank;
	}

	public void setDescRank(Integer descRank) {
		this.descRank = descRank;
	}
	
	@ExcelField(title="服务评论", align=2, sort=9)
	public Integer getServRank() {
		return servRank;
	}

	public void setServRank(Integer servRank) {
		this.servRank = servRank;
	}
	
	@ExcelField(title="货运评论", align=2, sort=10)
	public Integer getDeliverRank() {
		return deliverRank;
	}

	public void setDeliverRank(Integer deliverRank) {
		this.deliverRank = deliverRank;
	}
	
	@ExcelField(title="评论时的用户IP", align=2, sort=11)
	public String getIpAddress() {
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}
	
	@ExcelField(title="是否被管理员批准显示;1是;0未批准显示", align=2, sort=12)
	public String getIsShow() {
		return isShow;
	}

	public void setIsShow(String isShow) {
		this.isShow = isShow;
	}
	
	@JsonBackReference
	@ExcelField(title="评论的父节点,取值该表的comment_id字段,如果该字段为0,则是一个普通评论,否则该条评论就是该字段的值所对应的评论的回复", fieldType= Comment.class, value="parent.name", align=2, sort=13)
	public Comment getParent() {
		return parent;
	}

	public void setParent(Comment parent) {
		this.parent = parent;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="创建时间", align=2, sort=14)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
}